/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package miselania.tiposgenericos;
import java.util.Iterator;
/**
 *
 * @author cristhy
 */
 class NodoIterator<E> implements Iterator<E> {
     E datos1;
     NodoIterator<E> sgt;
     int posicion;

    public NodoIterator(E dato) {
        this.datos1=dato;
        this.sgt=null;
    }
    public NodoIterator(E dato, NodoIterator<E> siguiente) {
        this.datos1=dato;
        this.sgt=siguiente;
    }

    @Override
    public boolean hasNext() {
         NodoIterator<E> auxiliar= sgt;
        boolean resp= false;
        if (auxiliar != null )          
           resp=true;
        return resp;
    }

    @Override
    public E next() {
        //throw new UnsupportedOperationException("Not supported yet.");
          NodoIterator<E> auxiliar= sgt;
   
       if (auxiliar != null) {            
            return auxiliar.datos1;
        }
       else
           return null;
       
    }

    @Override
    public void remove() {
        throw new UnsupportedOperationException("Not supported yet.");
    }
    
}
